<template>
  <r-com :leftClass="left" :rightClass="right" :groupClass="group">
    <template slot="top-bar">
      <li class="el-icon-s-promotion">推广</li>
      <li v-for="item in 3" :key="item">
        <a href="#" class="el-icon-medal">鬼畜区的狂欢庆典</a>
      </li>
    </template>
    <template slot="video-slot">
      <a class="tg-vedio" href="#" v-for="item in tgVideoList" :key="item._id">
        <!-- 需要放一个鼠标聚焦后 播放截图的img -->
        <div class="video-fm">
          <el-image :src="item.fmPath" lazy></el-image>
          <span class="video-time">{{item.video_time}}</span>
          <video-effect :list="item.ImgList"></video-effect>
        </div>
        <a href="#" class="video-name a-link">{{item.title}}</a>
        <a href="#" class="up">up:{{item.author}}</a>
      </a>
    </template>
    <template slot="right-area">
      <a href="#" class="online-list a-link">在线列表</a>
      <a href="#" class="right-box-img">
        <el-image :src="'http://127.0.0.1:3030/tuiguang/7.png'"></el-image>
      </a>
    </template>
  </r-com>
</template>
<script>
import Rc from '../common/RowComponent'
import vf from '../common/VideoHover'
export default {
  data() {
    return {
      left: 'tg-leftheight',
      group: 'tg-groupheight',
      right: 'tg-rightheight',
      tgVideoList: [],
    }
  },
  components: {
    'r-com': Rc,
    'video-effect': vf,
  },
  async mounted() {
    this.tgVideoList = await this.getData('/index/tuiguang', 'fmPath', 'ImgList')
  },
  methods: {
    async getData(address, pathName, pathName2) {
      const { data: res } = await this.$http.get(address)
      res.forEach((item) => {
        const path = 'http://127.0.0.1:3030'
        item[pathName] = path + item[pathName]
        for (let i = 0; i < item[pathName2].length; i++) {
          item[pathName2][i] = path + item[pathName2][i]
        }
      })
      return res
    },
  },
}
</script>
<style scoped>
.video-name {
  display: inline-block;
  color: #000;
  width: 100%;
  font-size: 15px;
  -webkit-line-clamp: 2;
  text-overflow: ellipsis;
  padding: 10px 0;
  padding-right: 2px;
  height: 60px;
}
.video-time {
  display: inline-block;
  position: absolute;
  right: 0;
  bottom: 0;
  width: 100%;
  height: 30px;
  line-height: 30px;
  text-align: right;
  color: #fff;
  padding: 0 10px;
  background: linear-gradient(180deg, rgba(0, 0, 0, 0), rgba(0, 0, 0, 0.3));
}
.up {
  color: #888;
  transition: all 0.2s;
}

.online-list {
  display: block;
  width: 100%;
  height: 30px;
  line-height: 30px;
  background-color: #f4f4f4;
  border: 1px solid #e7e7e7;
  text-align: center;
}
.right-box-img {
  margin-top: 20px;
  display: block;
  width: 100%;
  height: 184px;
  border: 1px solid #e7e7e7;
}
.right-box-img .el-image {
  width: 100%;
  height: 100%;
}
</style>
